package com.nana.petadventure.utils.engine
{
	import com.nana.petadventure.ui.scene.BackgroundSprite;
	
	import flash.utils.getDefinitionByName;

	public class GameLevelUtil
	{
		public function GameLevelUtil()
		{
		}
		
		// 根据配置生成BackgroudSprite数组
		public static function getBgSpriteByConfig():Array {
			var bglist:Array = new Array();
			
			// fake data
			var bgs:Array = [{name:"SCENEBG_01_FARFAR",dis:4},{name:"SCENEBG_01_FAR",dis:3},{name:"SCENEBG_01_MID",dis:2},{name:"SCENEBG_01_NEAR",dis:1}];
			// TODO: 从配置文件中读取
			for each (var obj:Object in bgs) {
				var cls:Class = getDefinitionByName(obj["name"]) as Class;
				var bgSprite:BackgroundSprite =  new BackgroundSprite(cls,obj["dis"]);
				
				bglist.push(bgSprite);
			}
			
			return bglist;
		}
	}
}